#include "PrecompiledHeader.h"
#include "Renderbuffer.h"

/*--------------------------------------------------------------------------*/

Renderbuffer::Renderbuffer()
{
	glGenRenderbuffers(1, &this->m_renderbuffer);
}

/*--------------------------------------------------------------------------*/

Renderbuffer::~Renderbuffer()
{
	glDeleteRenderbuffers(1, &this->m_renderbuffer);
}

/*--------------------------------------------------------------------------*/

void Renderbuffer::Bind()
{
	glBindRenderbuffer(GL_RENDERBUFFER, this->m_renderbuffer);
}

/*--------------------------------------------------------------------------*/

void Renderbuffer::Unbind()
{
	glBindRenderbuffer(GL_RENDERBUFFER, 0);
}

/*--------------------------------------------------------------------------*/

void Renderbuffer::SetStorage(const glm::ivec2& size) const
{
	glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, size.x, size.y);
}

/*--------------------------------------------------------------------------*/

uint Renderbuffer::GetHandle() const
{
	return this->m_renderbuffer;
}

/*--------------------------------------------------------------------------*/